package base

import (
	"context"
	"rewords-server-2024/internal/library/cache"
	"rewords-server-2024/internal/model/mdo"
	"rewords-server-2024/internal/service"

	"rewords-server-2024/api/base/cacheAPI"
)

func (c *ControllerCacheAPI) SetData(ctx context.Context, req *cacheAPI.SetDataReq) (res *cacheAPI.SetDataRes, err error) {

	err = cache.Instance().Set(ctx, req.Key, req.Value, 0)

	mresult := &mdo.WxBaseLog{
		Openid:     "openid",
		UnionId:    "unionid",
		SessionKey: "sessionKe",
	}

	err = service.Mgx().InsertOne(ctx, "wx_base_log", mresult)

	return
}
